package com.xaaef.grpc.client.util;


import org.springframework.http.HttpStatus;


@lombok.Getter
@lombok.Setter
public class RestResponseWrapper<T> implements java.io.Serializable {

    private int status;

    private String message;

    private T data;

    public boolean isOk() {
        return this.status == HttpStatus.OK.value();
    }

    private RestResponseWrapper() {
    }

    public static <T> RestResponseWrapper<T> result(int status, String message, T data) {
        var result = new RestResponseWrapper<T>();
        result.status = status;
        result.message = message;
        result.data = data;
        return result;
    }

}
